package com.darrenchan.leetcode;

/**
 * @Desc
 * @Author chenchi03
 * @CreateTime 2020-04-23 10:45
 */
public class QLint49 {
    public void sortLetters(char[] chars) {
        if(chars == null || chars.length == 0) {
            return;
        }

        int i = 0, j = chars.length - 1;
        while (i <= j) {
            while (i <= j && Character.isLowerCase(chars[i])) {
                i++;
            }
            while (i <= j && Character.isUpperCase(chars[j])) {
                j--;
            }

            if(i <= j) {
                char temp = chars[i];
                chars[i] = chars[j];
                chars[j] = temp;

                i++;
                j--;
            }
        }
    }
}
